<!--危房鉴定列表-->
<template>
  <div id="houseAppraisal">
    <div style="padding: 4px">
      <van-cell-group>
        <van-field right-icon="search" style="background: #EEEEEE;border-radius: 5px;height:40px;font-size: 0.1em;" v-model="value" placeholder="请输入信息" />
      </van-cell-group>
    </div>
    <div class="content">
      <div v-if="isShow" style="height: 100%;text-align:center;">
        <div style="margin-bottom: 10px;">
          <img src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png">
        </div>
        <div>暂无数据</div>
      </div>
      <ul v-if="!isShow">
        <li v-for="(item,index) in contentData" :key="index" @click="contentDataClick(item)">
          <p style="font-weight: bold;">
            <span>{{item.F_HOUSEAPPLICANT}}</span>
            <template v-if="nowIndex===0">
              <span v-if="item.F_APPRAISAL==442" style="float: right;font-weight:800;margin-left: 70px;">已鉴定</span>
              <span v-else-if="item.F_APPRAISAL==241" style="float: right;color:red;font-weight:800;">未鉴定</span>
              <span v-else-if="item.F_APPRAISAL==242" style="float: right;color:blue;font-weight:800;">鉴定中</span>
              <span v-else style="float: right;font-weight:800;">{{item.F_APPRAISAL}}</span>
            </template>
            <template v-else>
              <span v-if="item.JDDJ!='246'" style="float: right;color:blue;font-weight:800;">{{item.JDDJ | inUseName(JDDJARR)}}</span>
              <span v-if="item.JDDJ==='246'" style="float: right;color:red;font-weight:800;">{{item.JDDJ | inUseName(JDDJARR)}}</span>
            </template>
          </p>
          <p style="font-size: 14px;color: #848484;">
            <span style="float: left;width:33.3%">房屋编号：{{item.F_FWTYBH}}</span>
            <span style="float: left;width:33.3%">排查时间：{{item.F_TROUBLESHOOTINGTIME?item.F_TROUBLESHOOTINGTIME.split(" ")[0]:""}}</span>
            <span style="float: right">排查人：{{item.F_TROUBLESHOOTINGREN}}</span>
          </p>
          <p style="clear: both;display: flex;align-items: center;" v-if="item.F_PERMANENTADDR">
            <img style="margin-right: 4px;" width="10" src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/YPC/dingwei.png" />
            <span style="font-size: 4px;color:blue">{{item.F_PERMANENTADDR}}</span>
          </p>
        </li>
      </ul>
    </div>
    <div class="bottom">
      <ul>
        <li v-for="(item,index) in bottomData" @click="bottomClick(index)" :style="{color:nowIndex===index?'#007AFF':'#000'}" :key="index">
          <img v-if="nowIndex===index" style="width: 16px;" :src="item.icon" />
          <img v-else style="width: 16px;" :src="item.icons" />
          <p>{{item.name}}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import dd from "gdt-jsapi";
import { QuerySignCallback } from '../../utils/api'
export default {
  data() {
    return {
      nowIndex: 0,
      isShow: false,
      value: "",
      contentData: [],
      JDDJARR: [],
      bottomData: [
        {
          name: '未鉴定',
          icon: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/1.png',
          icons: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/1-1.png',
        },
        {
          name: '已鉴定',
          icon: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/2.png',
          icons: 'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/2-2.png',
        },
        // {
        //   name:'危改审核',
        //   icon:'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/3.png',
        //   icons:'https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/WFJD/3-3.png',
        // }
      ]
    }
  },
  filters: {
    inUseName: function (msg, data) {
      let name = ''
      data.forEach(item => {
        if (item.DICID == msg) {
          name = item.DICNAME
        }
      })
      return name
    },
  },
  methods: {
    onClickLeft() {
      this.$router.push({
        path: "/FeatureList",
      });
    },
    bottomClick(index) {
      this.nowIndex = index
      this.getData()
    },
    contentDataClick(item) {
      if (this.nowIndex === 0) {
        this.$router.push({
          path: "/DetailInto",
          query: {
            data: JSON.stringify(item)
          }
        });
      } else {
        this.$router.push({
          path: "/IdentifiedDetails",
          query: {
            data: JSON.stringify(item)
          }
        });
      }
    },
    getEnum: async function () {
      let token = window.localStorage.getItem('token')
      let params = {
        accessCode: "688bd3883572440a859dfd8ba9194e7b",
        
        params: {
          dataguid: 'c7007467-d12c-4b87-948e-aa58b2df2131',
          searchObject: JSON.stringify([]),
          token: token,
        },
      };
      const res = await QuerySignCallback(params);
      this.JDDJARR = JSON.parse(res.data.data).Data
    },
    getData: async function () {
      let dataguid = '3b36a144-a96d-451f-bf26-43ff4583440f'
      if (this.nowIndex == 0) {
        dataguid = '3b36a144-a96d-451f-bf26-43ff4583440f'
      } else {
        dataguid = '6f336d50-fd9e-41d7-8f01-e515eb047ff3'
      }
      let params = {
        dataguid: dataguid,
        searchObject: JSON.stringify([]),
        token: window.localStorage.getItem('token')
      }
      this.contentData = []
      if (this.value) {
        params.searchObject = JSON.stringify([
          {
            field: 'F_HOUSEAPPLICANT',
            type: 'A',
            operator: 'like',
            value: this.value,
            link: 'AND'
          }
        ])
      }
      let params1 = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: params
      }
      const res = await QuerySignCallback(params1)
      if (res.data.data) {

      }
      let data = JSON.parse(res.data.data).Data
      this.contentData = data
      this.contentData.length > 0 ? this.isShow = false : this.isShow = true
    }
  },
  mounted() {
    this.getEnum()
    this.getData()
    dd.ready(function () {
      dd.setTitle({
        title: '疑似危房'
      })
        .then(res => {
        })
        .catch(err => {
          console.error(err)
        })
    })
  }
}
</script>
<style lang="scss" scoped >
#houseAppraisal {
  height: 100vh;
  background: #ffffff;
  //   font-size: 14px;
  .title {
    width: 100%;
    height: 50px;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
    position: relative;
  }
  .content {
    height: calc(100vh - 110px);
    overflow: auto;
    padding: 10px;
    ul li {
      border-bottom: 1px solid #d2d2d2;
      margin-bottom: 10px;
      clear: both;
      overflow: hidden;
      p {
        margin-bottom: 6px;
        clear: both;
        overflow: hidden;
      }
    }
  }
  .bottom {
    height: 60px;
    padding-top: 10px;
    text-align: center;
    ul li {
      float: left;
      width: 50%;
    }
  }
}
</style>
